var base = require('/base_info.js');
var utils = require('/utils/index.js');
// 富文本解析
var wxParse = require('/pages/wxParse-master/wxParse.js');
Page({
  data: {
    info: []
  },
  onLoad(query) {
    let that = this;
    utils.getData("SingleGuide", {}, function(res) {
      var data = res.data.data;
      that.setData({
        info: data
      })
      console.log(data);
      for(var key in data){
        for(var key2 in data[key].list){
          if (data[key].list[key2].type == 2) {

            let str = data[key].list[key2].content;
            str = str.replace(/li/g, "div");
            str = str.replace(/ul/g, "div");
            str = str.replace(/ol/g, "div");
            wxParse.wxParse(data[key].list[key2].class, 'html', str, that, 5);

          }
        }
      }
    }, function(err) {
      console.log(err); 
    });
  },
  onReady() {
    // 页面加载完成
  },
  onShow() {
    // 页面显示
  },
  onHide() {
    // 页面隐藏
  },
  onUnload() {
    // 页面被关闭
  },
  onTitleClick() {
    // 标题被点击
  },
  onPullDownRefresh() {
    // 页面被下拉
  },
  onReachBottom() {
    // 页面被拉到底部
  },
  onShareAppMessage() {
    // 返回自定义分享信息
    return {
      title: my.getStorageSync({
        key: 'hotel_name', // 缓存数据的key
      }).data,
      desc: my.getStorageSync({
        key: 'my_app_description', // 缓存数据的key
      }).data,
      path: 'pages/index/index?share=true',
      success: function (e) {
        console.log(e);
      }
    };
  },
});
